package com.yc.bbs.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.sql.Timestamp;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;

/**
 * <p>
 * BBS论坛-帖子表-19
 * </p>
 *
 * @author ly
 * @since 2024-11-23
 */
@Getter
@Setter
@TableName("tbl_topic")
public class Topic implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 编号, 自增列
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 标题
     */
    @NotEmpty(message = "请输入标题!")
    @Length(min = 1, max = 50, message = "标题至必须是1~50个字符")
    @TableField("title")
    private String title;

    /**
     * 内容, HTML格式
     */
    @NotEmpty(message = "请输入内容!")
    @Length(min = 1, max = 50, message = "内容长度至必须是1~20000个字符")
    @TableField("content")
    private String content;
    /**
     * 发表时间, 默认当前时间
     */

    @TableField("publishtime")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") // 格式化时间
    private Timestamp publishtime;

    /**
     * 修改时间, 用户最后修改回复信息的时间
     */

    @TableField("modifytime")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") // 格式化时间
    private Timestamp modifytime;

    /**
     * 用户编号, 发帖人
     */
    @TableField("uid")
    private Integer uid;

    /**
     * 板块编号
     */
    @TableField("boardid")
    private Integer boardid;

    @TableField(exist = false)
    private User user;

    @TableField(exist = false)
    private Long replyCnt;
}